package com.auerdi.ui.fragment.a_home.adapter.delegate;

import android.view.View;
import android.widget.ImageView;

import com.auerdi.R;
import com.auerdi.ui.fragment.a_home.adapter.items.HomeItemsBean;
import com.bumptech.glide.Glide;
import com.example.egghttp.retrofit.beans.banner.HomeBanner;
import com.zhy.adapter.recyclerview.base.ItemViewDelegate;
import com.zhy.adapter.recyclerview.base.ViewHolder;

/**
 * Created by zhy on 16/6/22.
 */
public class CisReportPic implements ItemViewDelegate<HomeItemsBean> {

    @Override
    public int getItemViewLayoutId() {
        return R.layout.item_home_c_reportpic;
    }

    @Override
    public boolean isForViewType(HomeItemsBean item, int position) {

//        item.getRouter()

        return item.getRouter().equals(getClass().getSimpleName());
    }

    @Override
    public void convert(ViewHolder holder, HomeItemsBean item, int position) {


        ImageView imgA = holder.getView(R.id.ads);
        imgA.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                EventBusActivityScope.getDefault((Activity) holder.getConvertView().getContext()).post(ADProductDetailRedFragment.newInstance(new Product()));

            }
        });
//        ImageView imgB = holder.getView(R.id.img_b);
//        ImageView imgC = holder.getView(R.id.img_c);
//        ImageView imgD = holder.getView(R.id.img_d);

        HomeBanner ads = (HomeBanner) item.getItem();


        Glide.with(holder.getConvertView().getContext())
                .asGif()
                .load(ads.getImg())
                .into(imgA);


    }
}
